package fr.umlv.m2.uwp2011.service.user;

public class UserDTO{
	/**
	 * 
	 */
	private String login;
	private Object password;
	private String givenName;
	private String lastName;
	private String mail;
	private Status status;
	
	public enum Status {
		student("student"), teacher("teacher"), admin("admin");

		private String label;

		Status(String pLabel) {
			this.label = pLabel;
		}

		public String getLabel() {
			return label;
		}

		public static Status selectStatus(String status) {
			if (status.equals("student")) {
				return student;
			} else if (status.equals("admin")) {
				return admin;
			} else if (status.equals("teacher")) {
				return teacher;
			} else
				return null;
		}
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public Object getPassword() {
		return password;
	}

	public void setPassword(Object password) {
		this.password = password;
	}

	public String getGivenName() {
		return givenName;
	}

	public void setGivenName(String givenName) {
		this.givenName = givenName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}
	
	public Status getStatus() {
		return status;
	}
	
	public void setStatus(Status status) {
		this.status = status;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}UserDTO userDTO = (UserDTO) obj;
		if (!userDTO.givenName.equals(this.givenName)){
			return false;
		}if (!userDTO.password.equals(this.password)){
			return false;
		}if (!userDTO.lastName.equals(this.lastName)){
			return false;
		}if (!userDTO.login.equals(this.login)){
			return false;
		}if (!userDTO.mail.equals(this.mail)){
			return false;
		}if (!userDTO.status.equals(this.status)){
			return false;
		}
		return true;
	}
}
